<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

namespace App\Utils\Enum;

class AccountEnum
{
    /**
     * 金币
     */
    public const int COINS = 1;

    /**
     * 积分
     */
    public const int INTEGRAL = 2;

    /**
     * 签到奖励
     */
    public const int TYPE_SIGN_REWARD = 100;

    /**
     * 任务奖励
     */
    public const int TYPE_TASK_REWARD = 101;

    /**
     * 抢红包
     */
    public const int TYPE_GET_PACKET = 102;

    /**
     * 代金券兑换
     */
    public const int TYPE_VOUCHER_EXCHANGE = 103;

    /**
     * 方案售出
     */
    public const int TYPE_SALE_PROJECT = 104;

    public const int TYPE_RECEIVE_GIFT = 105;

    /**
     * 购买爆料
     */
    public const int TYPE_BUY_PROJECT = 200;

    /**
     * 发红包
     */
    public const int TYPE_SEND_PACKET = 201;

    /**
     * 直播间赠送礼物
     */
    public const int TYPE_SEND_GIFTS = 202;

    /**
     * 收入
     */
    public const int DIRECTION_IN = 1;

    /**
     * 支出
     */
    public const int DIRECTION_OUT = 2;

    public const int COUPON_STATUS_NOT_ACTIVE = 0;
    public const int COUPON_STATUS_USABLE = 1;
    public const int COUPON_STATUS_USED = 2;
    public const int COUPON_STATUS_EXPIRE = 3;
    public const int COUPON_STATUS_DESTRUCT = 4;

    public const string PAYMENT_BALANCE = 'balance';

    /**
     * 获取变动类型.
     * @param mixed $direction
     */
    public static function getDirection($direction): string
    {
        return match ($direction) {
            self::DIRECTION_IN => '收入',
            self::DIRECTION_OUT => '支出',
            default => '未知'
        };
    }

    /**
     * 获取账户变动类型说明.
     * @param mixed $type
     */
    public static function getTypeName($type): string
    {
        return match ($type) {
            self::TYPE_VOUCHER_EXCHANGE => '代金券兑换',
            self::TYPE_SIGN_REWARD => '签到奖励',
            self::TYPE_GET_PACKET => '抢红包',
            self::TYPE_TASK_REWARD => '任务奖励',
            self::TYPE_RECEIVE_GIFT => '直播礼物',
            self::TYPE_BUY_PROJECT => '购买爆料',
            self::TYPE_SEND_PACKET => '发红包',
            self::TYPE_SEND_GIFTS => '赠送礼物',
            default => '未知',
        };
    }
}
